From: Michaƫl Cadilhac Date: Mon, 10 Sep 2007 09:58:29 +0000 (+0000) Subject: (dired-do-chmod): Change to use the built-in `set-file-modes' and the X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1^2~5^2~27115 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=822b17d34c7a87a6d77edab18a9b7a3793c7a6d6;p=emacs.git (dired-do-chmod): Change to use the built-in `set-file-modes' and the symbolic mode parsing functions. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7ba7f6fc71f..2fab7d98ad2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -8,6 +8,9 @@ (read-file-modes): New. Read either an octal value of a file mode or a symbolic value, and return its numeric value. + * dired-aux.el (dired-do-chmod): Change to use the built-in + `set-file-modes' and the previous symbolic mode parsing functions. + 2007-09-10 Stefan Monnier * textmodes/texinfo.el: Remove spurious * in docstrings. diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 124c53b44c5..f904238c8fa 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -253,9 +253,20 @@ List has a form of (file-name full-file-name (attribute-list))" ;;;###autoload (defun dired-do-chmod (&optional arg) "Change the mode of the marked (or next ARG) files. -This calls chmod, thus symbolic modes like `g+w' are allowed." +Symbolic modes like `g+w' are allowed." (interactive "P") - (dired-do-chxxx "Mode" dired-chmod-program 'chmod arg)) + (let* ((files (dired-get-marked-files t arg)) + (modes (dired-mark-read-string + "Change mode of %s to: " nil + 'chmod arg files)) + (num-modes (if (string-match "^[0-7]+" modes) + (string-to-number modes 8)))) + (dolist (file files) + (set-file-modes + file + (if num-modes num-modes + (file-modes-symbolic-to-number modes (file-modes file))))) + (dired-do-redisplay arg))) ;;;###autoload (defun dired-do-chgrp (&optional arg)